import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders'
import { defineConfig, presetIcons, transformerDirectives, transformerVariantGroup } from 'unocss'
import { presetUni } from '@uni-helper/unocss-preset-uni'

export default defineConfig({
  theme: {
    colors: {
      pri: {
        DEFAULT: '#436EF6',
        10: '#436EF61A',
      },
      warning: {
        DEFAULT: '#E6A23C',
        bg: '#FCF6EC',
      },
      error: {
        DEFAULT: '#FF5A5A',
        bg: '#FEF0F0',
      },
      red: {
        DEFAULT: '#FF1515',
      },
      gray: {
        DEFAULT: '#8995AD',
        holder: '#B0BCC8',
        bg: '#f1f3f5',
        200: '#e5e7eb',
      },
      black: {
        DEFAULT: '#282C3B',
      },
    },
  },
  presets: [
    presetUni(),
    // presetIcons({
    //   scale: 1.2,
    //   warn: true,
    //   extraProperties: {
    //     'display': 'inline-block',
    //     'vertical-align': 'middle',
    //   },
    // }),
    presetIcons({
      customizations: {
        iconCustomizer(collection, icon, props) {
          props.width = '1em'
          props.height = '1em'
        },
      },
      collections: {
        'wx': FileSystemIconLoader('./public/icons/wx'),
        'form': FileSystemIconLoader('./public/icons/form'),
        'hm': FileSystemIconLoader('./public/icons/HarmonyOS_Icons'),
        'hms': FileSystemIconLoader('./public/icons/HMSymbol'),
        'proj': FileSystemIconLoader('./public/icons/proj'),
      },
    }),
  ],
  transformers: [
    transformerDirectives(),
    transformerVariantGroup(),
  ],
})
